package hotciv.tools;

import hotciv.framework.Game;
import hotciv.view.GfxConstants;

import java.awt.event.MouseEvent;

import minidraw.framework.Drawing;
import minidraw.framework.DrawingEditor;
import minidraw.framework.Figure;
import minidraw.standard.NullTool;

public class ShieldTool extends NullTool 
{
	private Figure shield;
	private Game game;
	private Drawing drawing;
	private DrawingEditor editor;
	
	public ShieldTool(Game game, DrawingEditor editor)
	{		
		this.game = game;
		shield = editor.drawing().findFigure(GfxConstants.TURN_SHIELD_X, GfxConstants.TURN_SHIELD_Y);
		this.drawing = editor.drawing();
		this.editor = editor;
		
	}
	public void mouseUp(MouseEvent e, int x, int y)
	{
		if(drawing.findFigure(x, y) == shield)
		{
			game.endOfTurn();
			editor.showStatus("Player: "+game.getPlayerInTurn());
		}
	}
}
